<template>
  <div>
    <div id="main" style="display:inline-block; width: 800px; height: 600px">欢迎！！{{ user }}</div>
    <div id="bing" style="display:inline-block; width: 800px; height: 600px">欢迎！！{{ user }}</div>
  </div>

</template>

<script>
import * as echarts from 'echarts';

export default {
  data() {
    return {
      user: 'master'
    }

  },
  mounted() {
    var chartDom = document.getElementById('main');
    var myChart = echarts.init(chartDom);
    var option;

    option = {
      xAxis: {
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
      },
      yAxis: {
        type: 'value'
      },
      series: [
        {
          data: [150, 230, 224, 218, 135, 147, 260],
          type: 'line'
        },
        {
          data: [150, 230, 224, 218, 135, 147, 260],
          type: 'bar'
        }
      ]
    };

    var chartDom = document.getElementById('bing');
    var myChart_bing = echarts.init(chartDom);
    var option_bing;

    option_bing = {
      title: {
        text: 'Referer of a Website',
        subtext: 'Fake Data',
        left: 'center'
      },
      tooltip: {
        trigger: 'item'
      },
      legend: {
        orient: 'vertical',
        left: 'left'
      },
      series: [
        {
          name: 'Access From',
          type: 'pie',
          radius: '50%',
          data: [
            { value: 1048, name: 'Search Engine' },
            { value: 735, name: 'Direct' },
            { value: 580, name: 'Email' },
            { value: 484, name: 'Union Ads' },
            { value: 300, name: 'Video Ads' }
          ],
          emphasis: {
            itemStyle: {
              shadowBlur: 10,
              shadowOffsetX: 0,
              shadowColor: 'rgba(0, 0, 0, 0.5)'
            }
          }
        }
      ]
    };

    option_bing && myChart_bing.setOption(option_bing);
    option && myChart.setOption(option);

  }

}


</script>

<style scoped>

</style>